//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System.Web;
using WCSFContrib.PageFlow.Utils;

namespace WCSFContrib.PageFlow.Services
{
	/// <summary>
	/// A simple implementation of the <see cref="INavigationService"/> interface.
	/// </summary>
	/// <remarks>
	/// This implementation uses the <see cref="HttpResponse"/>'s Redirect() method.
	/// </remarks>
	public class NavigationService : INavigationService
	{
		/// <summary>
		/// Redirects to a specified <see cref="Page"/>.
		/// </summary>
		/// <param name="page"></param>
		/// <exception cref="System.ArgumentNullException">
		/// <paramref name="page"/> is <see langword="null"/> 
		/// </exception>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", Justification = "Validation done by Guard class.")]
        public void RedirectTo(Page page)
		{
			Guard.ArgumentNotNull(page, "page");
			HttpContext.Current.Response.Redirect(page.Url);
		}
	}
}
